package com.itheima.springboot_condition.config;

import com.itheima.springboot_condition.condition.ClassCondition;
import com.itheima.springboot_condition.condition.ConditionOnClass;
import com.itheima.springboot_condition.domain.Role;
import com.itheima.springboot_condition.domain.User;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

@Configuration
public class UserConfig {

    @Bean
    //@Conditional(ClassCondition.class)
    //------------使用自定义注解-------------
    //@ConditionOnClass("redis.clients.jedis.Jedis")
    public User user(){
        return new User();
    }

    @Bean
    @ConditionalOnProperty(name = "Akimoto",havingValue = "Manatsu")
    public User user2(){
        return new User();
    }


    @Bean
    public Role role(){
        return new Role();
    }
}
